package main

import (
	"bufio"
	"fmt"
	"os"
)

func WriteFile() {
	filePath := "d:/go_write.txt"
	file, err := os.OpenFile(filePath, os.O_APPEND|os.O_CREATE, 0666)
	if err != nil {
		fmt.Println("打开文件错误")
		return
	}
	defer file.Close()
	strs := "hello 中国 chinese\n"
	writer := bufio.NewWriter(file)
	for i := 0; i < 5; i++ {
		writer.WriteString(strs)
	}
	writer.Flush()

}
func main() {
	WriteFile()
}
